﻿using DA.AnimGraph;

namespace DA.AnimGraph.Editor {

    internal class AGESetting {

        public AGEditorSettingObject settingObject { get; private set; }

        public AGESetting() {
            settingObject = AnimGraphAssetsUtility.LoadEditorSetting();
        }
        public void Save() {
            AnimGraphAssetsUtility.SaveEditorSetting(settingObject);
        }
        public SettingData ToSettingData() {
            var data = new SettingData();
            data.extensionType = new RefField<ExtensionType>(settingObject.extensionType);
            data.exportResourcesWhenExport = new RefField<bool>(settingObject.exportResourcesWhenExport);
            return data;
        }
        public void Apply(SettingData data) {
            settingObject.extensionType = data.extensionType.value;
            settingObject.exportResourcesWhenExport = data.exportResourcesWhenExport.value;
            Save();
        }
        public string GetExtensionType() {
            return settingObject.extensionType switch {
                ExtensionType.bytes => "bytes",
                ExtensionType.bin => "bin",
            };
        }
    }


}
